<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="../static/layui/css/layui.css" />
		<script src="../static/jquery-3.5.1.min.js"></script>
		<script src="../static/layui/layui.js"></script>
	</head>
	
	<body>

		<div class="layui-bg-gray" style="padding: 30px;">
		  <div class="layui-row layui-col-space15">
		    <div class="layui-col-md6">
		      <div class="layui-card">
		        <div class="layui-card-header">个人信息</div>
		        <div class="layui-card-body">
					用户名:<span id="Jusername"></span><br />
					昵称:<span id="Jnickname"></span><br />
					学号:<span id="JstuID"></span><br />
<!-- 					信誉:<span id="Jcredit"></span><br />
					金币:<span id="Jmoney"></span><br /> -->
		        </div>
		      </div>
		    </div>
		  </div>
		</div> 


		<script type="text/javascript">
			// = {
			// 	"code": 200,  // 状态码
			// 	"msg": "成功",  // 提示信息
			// 	"data": {
			// 		"nickname": "123",
			// 		"stuID": "123123",
			// 		"userCredit": "22",
			// 		"userMoney":"222"
			// 	}
			// }
		
				$.ajax({
				  xhrFields:{withCredentials: true},
				  type: "GET",
				  url: 'http://127.0.0.1:8000/api/v1/users/0/',
				  contentType:'application/json;charset=UTF-8',
				  dataType:"json",
				  success:function(data){
				  		if(data.code==200){
							var jsonobj = data.data;
							var nickname = jsonobj.nickname;
							var stuID = jsonobj.stuID;
							var username = jsonobj.username;
							//var userCredit = jsonobj.userCredit;
							//var userMoney = jsonobj.userMoney;
							
							document.getElementById("Jnickname").innerHTML=nickname;
							document.getElementById("JstuID").innerHTML=stuID;
							document.getElementById("Jusername").innerHTML=username;
				  		 }else{
				  		  layer.msg(data.msg);
				  		 }
				  }
				});
			
			// var jsonobj = JSONobject.data;
			// var nickname = jsonobj.nickname;
			// var stuID = jsonobj.stuID;
			// var username = jsonobj.username;
			// //var userCredit = jsonobj.userCredit;
			// //var userMoney = jsonobj.userMoney;
			
			// document.getElementById("Jnickname").innerHTML=nickname;
			// document.getElementById("JstuID").innerHTML=stuID;
			// document.getElementById("Jusername").innerHTML=username;
			// // document.getElementById("Jcredit").innerHTML=userCredit;
			// // document.getElementById("Jmoney").innerHTML=userMoney;
			
		
		</script>
		
	</body>
</html>
